This is a project to prepare Food Access data to join with spatial files to put in Tableau. We’re basically trying to make a version of this map, you can build here.
food-atlas
Unfortunatly, in the end Tableau isn’t as cool as the atlas above (which I think is ArcGIS online.)
Data file Food Access Research Atlas Data Download 2015 downloaded from United States Department of Agriculture. It is downloaded as data-raw/DataDownload2015.xlsx. This has three tabs. I saved the tab Variables Lookup as it’s own file data-dictionary.xlsx for reference in a smaller file. There is documentation for the food access varialbles.
01-import imports the file from Excel, selects the columns we need and filters it to Travis County, Texas. There are 2018 rows.
02-data-wrangle does some data checking and creates columns that can more easily show the food access level of each census tract.
Exports from this notebook will be used to join datain QGIS.
03-mapping maps the “Limited Access” and “Limited Income and Limited Access” columns using ggplot and tigris.
The qgis folder has a project food_access.qgz that has Travis Census tracts and joins with the data wrangled from 02-data-wrangle as data-processed/tfa.csv.
tl_2019_48_tracts/travis_tract.gpkg is the travis shapefile, filtered from the original, also there.data-processed/tfa.csv.travis_food_access shapefile called tfa.shp (and companion files). A compressed zip is also available.In the tableau folder is a workbook FoodDesert.twb that imports the tfa.shp file as a Spatial file and then creates the two interactive maps.
This Tableau help file was useful in dealing with the shapefiles. Of importance: add the Geoid to detial to split the individual tracts.
The folder csvkit has some earlier work to convert the Excel file to csv. It’s moot at this point, but I’m keeping it as a learning experience.
I started working on this project in R because I thought I would have to do a complicated reshape and filter to build the food access columns for “Limited Access” and “Limited Income Limited Access”, but once I figured out the logic of the columns I found I only needed two of them for our county, so a nested IF would suffice.
I tried later to go back to Workbench (the platform where I started this project) to do the IF, but I found their Excel formulas do not support the AND function, at least not within and IF.
I was able to build the columns in a Google sheet Food access formula. That file was started from the end of the “Import” sheet in the Workbench workbook. It wasn’t used … I just wanted to figure out the formula.